package com.pan.admin.module.crm.dao;

import com.pan.admin.module.crm.entity.CrmDistributeLoanUser;
import com.pan.admin.module.crm.entity.po.CrmLoanUserDistributeStatusPO;
import com.pan.admin.module.crm.entity.qo.CrmLoanUserDistributeStatusQO;
import com.pan.admin.module.crm.entity.vo.CrmDeptVO;
import com.pan.admin.module.crm.entity.vo.CrmDistributeLoanUserVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 甲方与用户关联Dao接口
 *
 * @author ts
 * @date 2023-11-13
 */
@Mapper
public interface CrmDistributeLoanUserDao {

    /**
     * 根据ID获取列表甲方与用户关联
     *
     * @param id 甲方与用户关联主键
     * @return 甲方与用户关联
     */
    CrmDistributeLoanUser getById(Long id);

    /**
     * 根据
     * @param loanUserId
     * @return
     */
    CrmDistributeLoanUserVO getByLoanUserId(CrmDistributeLoanUserVO crmDistributeLoanUserVO);

    /**
     * 查询甲方与用户关联列表
     *
     * @param crmLoanUser 甲方与用户关联
     * @return 甲方与用户关联集合
     */
    List<CrmDistributeLoanUserVO> list(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 查询渠道用户分配状态
     *
     * @param  crmLoanUserDistributeStatusQO
     * @return List
     */
    List<CrmLoanUserDistributeStatusPO> listUserDistributeStatus(CrmLoanUserDistributeStatusQO crmLoanUserDistributeStatusQO);

    /**
     * 默认选中的ID
     *
     * @param crmLoanUser
     * @return
     */
    List<Integer> listByTree(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 树控 左
     *
     * @param crmLoanUser
     * @return
     */
    List<CrmDeptVO> treeLeft(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 默认选中
     *
     * @param crmLoanUser
     */
    List<Integer> listLeftDefault(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 子公司节点
     *
     * @param crmLoanUser
     * @return
     */
    List<CrmDeptVO> listByTreeParent(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 根据员工ID 渲染父节点
     *
     * @param crmLoanUser
     * @return
     */
    CrmDeptVO listByTreeParentRight(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 可选用户节点
     *
     * @param crmLoanUser
     * @return
     */
    List<CrmDistributeLoanUserVO> listByTreeChildren(CrmDistributeLoanUserVO crmLoanUser);

    /**
     * 新增甲方与用户关联
     *
     * @param crmLoanUser 甲方与用户关联
     * @return 结果
     */
    int insertLoanJfUser(CrmDistributeLoanUser crmLoanUser);

    /**
     * 修改甲方与用户关联
     *
     * @param crmLoanUser 甲方与用户关联
     * @return 结果
     */
    int updateLoanJfUser(CrmDistributeLoanUser crmLoanUser);

    /**
     * 删除甲方与用户关联
     *
     * @param id 甲方与用户关联主键
     * @return 结果
     */
    int deleteById(Long id);

    /**
     * 批量删除甲方与用户关联
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int batchDeleteById(Long[] ids);

    /**
     * 条件删除
     *
     * @param userId
     * @return
     */
    int batchDelete(Integer userId);

    /**
     * 批量新增
     *
     * @param userList
     * @return
     */
    int batchInsert(List<CrmDistributeLoanUser> userList);

    /**
     * 根据条件查询是否已有
     *
     * @param crmLoanUser
     * @return
     */
    int count(CrmDistributeLoanUser crmLoanUser);


}
